

from base import Base
from selenium.webdriver.common.by import By
from time import sleep

class GuanZhuYeWu(Base):

    guanzhutag = (By.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.ImageView')
    guanzhuanniu = (By.ID, 'com.kongfz.app:id/lottie_attention')
    dian = (By.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.view.ViewGroup/android.view.ViewGroup/androidx.viewpager.widget.ViewPager/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.TextView[2]')
    dy = (By.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.TextView[3]')

    def guanzhuyewu(self):
        self.find_ele(self.guanzhutag).click()
        sleep(2)
        self.find_ele(self.guanzhuanniu).click()
        sleep(2)
        self.find_wait_ele(self.dian).click()
        sleep(3)


    sosuokuang = (By.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.view.ViewGroup/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.TextView[2]')
    shurukuang = (By.ID, 'com.kongfz.app:id/et_search')
    sosuoanniu = 'new UiSelector().text("搜索")'
    dy2 = (By.ID, 'com.kongfz.app:id/tv_see_all_content')

    def sosuoyewu(self, neirong):
        self.find_ele(self.guanzhutag).click()
        sleep(2)
        self.find_ele(self.sosuokuang).click()
        sleep(2)
        self.find_wait_ele(self.shurukuang).send_keys(neirong)
        sleep(2)
        self.find_ele(self.sosuoanniu).click()
        sleep(3)

